(function( $ ){
	
	  $.fn.sabrina = function( options ) {
		
		 // build main options before element iteration
		var opts = $.extend({}, $.fn.sabrina.defaults, options);	
				
		// iterate and reformat each matched element
	    return this.each(function() {
	    	var $this = $(this);
	    	var iframeId = "iframe"+opts.element;
	    	
	    	var div = $("<div id='dialog"+opts.element+"' title='"+opts.title+"'/>");
	    	div.append($("<iframe id='"+iframeId+"' name='content_frame' marginwidth='0' marginheight='0' width='0' height='0' frameborder='0' scrolling='no'/>"));
	    	$this.append(div);
	    	
	    	$this.bind('click', function (event) {
	    		sender=opts.element;
	    		var iframe = $("#" + iframeId);	    		
	    		iframe.attr("src",opts.iframe).attr("height", opts.height-60).attr("width", opts.width-35);	    		
	    		
	    		$("#dialog" + opts.element).dialog({
	    			resizable: false,
	    			height: opts.height,
	    			width: opts.width,
	    			modal: true
	    			/*,
	    			buttons: {
	    				" OK ": function() {
	    					
	    					$( this ).dialog( "close" );
	    				},
	    				Cancel: function() {
	    					window.frames[iframeId].cancel();
	    					$( this ).dialog( "close" );
	    					
	    				}
	    			}*/
	    		});
	    	});
	    	
	        // call our format function
	        //t = $.fn.hilight.callback(markup);
	    });
	 };
	 
		  
	  // define and expose our callback function	  
	  $.fn.sabrina.callback = function(txt) {
	    return '<strong>' + txt + '</strong>';
	  };
	  
	  // plugin defaults	  
	  $.fn.sabrina.defaults = {
		   title: 'Hello, Sabrina!',
		   height : '600',
		   width : '600',
		   iframe: 'iframe.htm'
	  };
	 	  	
})( jQuery );



